package com.yidao.core.domain;

import java.sql.Timestamp;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

@MappedSuperclass
public class BaseDomainObject implements java.io.Serializable{

	private static final long serialVersionUID = 1L;
	
	public static final int STATUS_ACTIVE = 1;
	
	public static final int STATUS_DEACTIVE = 0;
	
	public static final int STATUS_DELETED = 2;

	protected Calendar createTime;
	
	protected Long id;
	
	protected int status;
	
	protected Calendar updateTime;
	
	@Column
	public Calendar getCreateTime() {
		return createTime;
	}	

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	
	@Column(nullable=false)
	public int getStatus() {
		return status;
	}

	@Column
	public Calendar getUpdateTime() {
		return updateTime;
	}

	public void setCreateTime(Calendar createTime) {
		this.createTime = createTime;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public void setStatus(int status) {
		this.status = status;
	}

	public void setUpdateTime(Calendar updateTime) {
		this.updateTime = updateTime;
	}

	@Override
	public String toString() {
		ToStringBuilder tsb = new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE);
		tsb.append("id",id);
		tsb.append("status",status);
		return tsb.toString();
	}
}
